Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

117
Views
ingrese "datetime-local"> código js que hace que los segundos se ejecuten/se muevan con precisión para que se actualice el tiempo

Me gustaría saber cómo hacer que los segundos corran/se muevan con precisión para que cambie la hora. ¿Hay alguna forma de hacerlo con el script js que proporcioné a continuación?

gracias a todos.

 functionName(); //First execution setInterval(functionName, 1000); //Ask the browser to execute functionName as soon as possible after 1 second has passed function functionName(){ var now = new Date(); now.setMinutes(now.getMinutes() - now.getTimezoneOffset()); document.getElementById('dt').value = now.toISOString().slice(0,16); }
 <input readonly="readonly" name="dt" id="dt" type="datetime-local" step="1" />

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Usar getSeconds y setSeconds funciona:

También cambié el segmento de cadena a .slice(0,19) para mostrar los segundos actualizados.

 functionName(); //First execution setInterval(functionName, 1000); //Ask the browser to execute functionName as soon as possible after 1 second has passed function functionName(){ var now = new Date(); now.setSeconds(now.getSeconds() - now.getTimezoneOffset()); document.getElementById('dt').value = now.toISOString().slice(0,19); }
 <input readonly="readonly" name="dt" id="dt" type="datetime-local" step="1" />

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!